﻿<html>
 <head>
  	<meta charset="utf-8"/>
	<title>GameLuanVan</title>
	<meta name="description" content="" />
<script src="js/swfobject.js"></script>
	<script>
		var flashvars = {
		};
		var params = {
			menu: "false",
			scale: "noScale",
			allowFullscreen: "true",
			allowScriptAccess: "always",
			bgcolor: "",
			wmode: "direct" // can cause issues with FP settings & webcam
		};
		var attributes = {
			id:"GameLuanVan"
		};
		swfobject.embedSWF(
			"GameLuanVan.swf", 
			"altContent", "100%", "100%", "10.0.0", 
			"expressInstall.swf", 
			flashvars, params, attributes);
	</script>
	<style>
		html, body { height:100%; overflow:visibled; }
		body { margin:0; }
	</style>
 </head>
 <body>
 <div id="altContent">
<h1>"Haivl"</h1>
		<h1>GameLuanVan</h1>
		
		<p><a href="http://www.adobe.com/go/getflashplayer">Get Adobe Flash player</a></p>
	</div>
 </body>
</html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Feed test</title>
	<script type="text/javascript" src="http://static.me.zing.vn/zmjs/zmCore-1.54.min.js" ></script>
	<script type="text/javascript" src="http://static.me.zing.vn/feeddialog/js/zmfeeddialog-2.02.min.js" ></script>
</head>
<body>


<?php

include_once 'zingme-sdk/BaseZingMe.php';
include_once 'zingme-sdk/ZME_Me.php';
include_once 'zingme-sdk/ZME_User.php';
include_once 'zingme-sdk/ZME_FeedDialog.php';



$config_live = array(
	'appname' => 'haohung',
	'apikey' => '569637a702974dca85b98e3e2553bfcc',
	'secretkey' => 'c53050cccbe3450fbaadcb3baa019249',
	'env' => 'production'
);

$config = $config_live;
$zm_Me = new ZME_Me($config);
$signed_request = $_REQUEST['signed_request'];
$access_token = $zm_Me->getAccessTokenFromSignedRequest($signed_request);

$me = $zm_Me-> getInfo($access_token, $fields = "id,username,displayname");
//feed
$uid = $zm_Me-> getUserLoggedIn($signed_request);

$secretkey = $config['secretkey'];
$userIdFrom = $uid;
$userIdTo = 0; //not support to userid_to
$actId = 1;
$tplId = 3;
$objectId = "";
$attachName = $me["displayname"]." đã chiến thắng Ngô Xương Xí";
$attachHref = "http://me.zing.vn/apps/haohung";
$attachCaption = "lichsuviet.com";
$attachDescription = "Trải qua rất nhiều khó khăn, quân ta đã chiến thắng Ngô Xương Xí";
$mediaType = 1;
$mediaImage = "http://localhost/background1.png";
$mediaSource = "http://me.zing.vn/apps/haohung";
$actionLinkText = "Hào Hùng";
$actionLinkHref = "http://me.zing.vn/apps/haohung";

$feedItem = new ZME_FeedItem($userIdFrom, $userIdTo, $actId, $tplId, $objectId, $attachName, $attachHref, $attachCaption, $attachDescription, $mediaType, $mediaImage, $mediaSource, $actionLinkText, $actionLinkHref);
$zm_FeedDialog = new ZME_FeedDialog($config);

$sig = $zm_FeedDialog->genFeedSigForDialog($feedItem);

//echo "signature=" . $sig;
//echo "<br>";

$feedId = 4584475422;
$validateKey = "fcc94127f2b6f628accc2931fd00d2b1";

$feedId_aftervalidate = $zm_FeedDialog->validateFeedId($feedId, $validateKey);
?>
	
<script>
	
function Get_User_Name(){
		return "<?php echo $me["username"] ?>";
}
function Get_DisPlay_Name(){
		return "<?php echo $me["displayname"] ?>";
}
//feed
function openFeedDialog(){
zmf.ui(
	{
		pub_key:"<?php echo $config['apikey']?>",
		sign_key:"<?php echo $sig?>",
		action_id:<?php echo $actId?>,
		uid_to: <?php echo $userIdTo?>,
		object_id: "",
		attach_name: "<?php echo $attachName?>",
		attach_href: "<?php echo $attachHref?>",
		attach_caption: "<?php echo $attachCaption?>",
		attach_des: "<?php echo $attachDescription?>",
		media_type:<?php echo $mediaType?>,
		media_img:"<?php echo $mediaImage?>",
		media_src:"<?php echo $mediaSource?>",
		actlink_text:"<?php echo $actionLinkText?>",
		actlink_href:"<?php echo $actionLinkHref?>",
		tpl_id:<?php echo $tplId?>,		
		suggestion: ["Chia se cho ban be", "Chia sẻ cho bạn bè", "Mời bạn bè"],
		state:<?php echo "123456"?>,
		callback : "fCallback",
		domainpath : "http://localhost/"
	});
}
</script>

</body>
</html>
